package zl.classloader;

class Hello{
	private String str = "HelloWorld!!!";
	
	public void sayHello()
	{
		System.out.println(str);
	}
}


public class Test {

	@SuppressWarnings("rawtypes")
	public static void main(String[] args)
	{
		
		System.out.println(ClassLoader.getSystemClassLoader());  
		
		System.out.println(ClassLoader.getSystemClassLoader().getParent());
		
		System.out.println(ClassLoader.getSystemClassLoader().getParent().getParent());
		
		System.out.println(String.class.getClassLoader());
		System.out.println("ExtClassLoader："+System.getProperty("java.ext.dirs"));
		System.out.println("AppClassLoader："+System.getProperty("java.class.path"));
		
		//URL[] urls = sun.misc.Launcher.getBootstrapClassPath().getURLs();
		System.out.println("----------------------------------");
		Hello hello = new Hello();
		hello.sayHello();
		ClassLoader clofhello = Hello.class.getClassLoader();
		System.out.println("Hello is load by:" + clofhello);
		System.out.println("----------------------------------");
		Class c = clofhello.getClass();
		while(c !=null){
			System.out.println(c);
			c = c.getSuperclass();
		}
		System.out.println("----------------------------------");
		c = clofhello.getParent().getClass();
		System.out.println(clofhello+"'parent is:" + c);
		System.out.println("----------------------------------");
		while(c !=null){
			System.out.println(c);
			c = c.getSuperclass();
		}
	}
}
